<?php


/**
* CakePHP Schema Plugin
* http://cake-schema-plugin.googlecode.com
*
* @package schema
* @subpackage schema.config.schema
* @author Ivan Chistyakov <zetruger@gmail.com>
* @version $Id: schema_auto.php 99 2010-10-11 13:54:03Z zetruger@gmail.com $
* @link $HeadURL: http://cake-schema-plugin.googlecode.com/svn/trunk/config/schema/schema_auto.php $
* @license MIT License (http://opensource.org/licenses/mit-license.php)
*/


class SchemaAutoSchema extends CakeSchema {

var $name = 'SchemaAuto';

function __construct($options = array()) {
	parent::__construct($options);
	foreach (App::objects('model') as $modelClass) {
		if (App::import('Model', $modelClass)) {
			$modelVars = get_class_vars($modelClass);
			if (isset($modelVars['_schema'])) {
				if (!isset($modelVars['useTable'])) {
					$this->tables[Inflector::tableize($modelClass)] = $modelVars['_schema'];
				} elseif (!empty($modelVars['useTable'])) {
					$this->tables[$modelVars['useTable']] = $modelVars['_schema'];
				}
			}
		}
	}
}

}


?>